<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加商品</title>
<style>
	/* styles.css */
body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 20px;
}

form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    white-space: nowrap;
    background-color: #f0f0f0;
}

input[type="text"], select, textarea {
    width: 100%;
    padding: 8px;
    margin: 4px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="file"] {
    border: none;
    margin: 4px 0;
}

input[type="submit"] {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: #28a745;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

input[type="submit"]:hover {
    background-color: #218838;
}

/* 响应式设计 */
@media (max-width: 768px) {
    form {
        width: auto;
        padding: 10px;
    }
}
</style>
</head>
<body>
    <form action="AdminAddGoodServlet" method="post" enctype="multipart/form-data">
        <table>
            <tr>
                <th>商品名：</th>
                <td><input name="name" type="text" required></td>
            </tr>
            <tr>
                <th>商品价格：</th>
                <td><input name="price" type="text" required></td>
            </tr>
            <tr>
                <th>商品库存：</th>
                <td><input name="stuck" type="text" required></td>
            </tr>
            <tr>
                <th>类别：</th>
                <td>
                    <select name="category" required>
                        <c:forEach items="${categoryList}" var="category">
                            <option value="${category.getCategory()}">${category.getCategoryName()}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr>
                <th>供应商：</th>
                <td>
                    <select name="provider" required>
                        <c:forEach items="${providerList}" var="provider">
                            <option value="${provider.getProviderId()}">${provider.getProviderName()}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr>
                <th>图片：</th>
                <td><input type="file" name="picture" required></td>
            </tr>
            <tr>
                <td colspan="2" style="text-align:center;">
                    <input type="submit" value="提交">
                </td>
            </tr>
        </table>
    </form>
</body>
</html>